package com.wiscamp.ninechapters.problems.infrastructure.po.types;

import com.wiscamp.ninechapters.ddd.PersistenceObject;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.time.LocalDateTime;

/**
 * 问题类型
 */
@Data
@Table(name = "question_types_view")
@Entity
@EqualsAndHashCode
public class QuestionTypeView implements PersistenceObject {
    @Serial
    private static final long serialVersionUID = -3717804855448218132L;

    /**
     * 题型编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(insertable = false, name = "type_id", nullable = false)
    private long typeId = 0;

    /**
     * 题型代码
     */
    @Column(name = "type_code", nullable = false)
    private String typeCode = "";

    /**
     * 题型名称
     */
    @Column(name = "type_name", nullable = false)
    private String typeName = "";

    /**
     * 问题模式
     */
    @Column(name = "question_mode_id", nullable = false)
    private int questionModeId = 0;

    /**
     * 是否有高亮提示
     */
    @Column(name = "has_highlight", nullable = false)
    private boolean hasHighlight = false;

    /**
     * 是否客观题
     */
    @Column(name = "objective_question", nullable = false)
    private boolean objectiveQuestion = true;

    /**
     * 是否有选项
     */
    @Column(name = "has_option", nullable = false)
    private boolean hasOption = false;

    /**
     * 是否随机选项
     */
    @Column(name = "random_option", nullable = false)
    private boolean randomOption = false;

    /**
     * 选项数量
     */
    @Column(name = "option_quantity", nullable = false)
    private int optionQuantity = 0;

    /**
     * 答题描述
     */
    @Column(name = "answer_description")
    private String answerDescription = "";

    /**
     * 答题描述语音
     */
    @Column(name = "answer_description_audio")
    private String answerDescriptionAudio = "";


    /**
     * 是否确认答题
     */
    @Column(name = "confirm_answer", nullable = false)
    private boolean confirmAnswer = false;

    /**
     * 答案是否排序
     */
    @Column(name = "sort_answer", nullable = false)
    private boolean sortAnswer = false;

    /**
     * 答案是否分组
     */
    @Column(name = "group_answer", nullable = false)
    private boolean groupAnswer = false;

    /**
     * 解析类型
     */
    @Column(name = "solution_type_id", nullable = false)
    private int solutionTypeId = 0;

    /**
     * 编辑器类型 1094-Multiple Choice 1095-Calculation
     * if the editor type is calculation , the answer type must be 'Number'.
     */
    @Deprecated
    @Column(name = "editor_type_id", nullable = false)
    private int editorTypeId = 0;

    /**
     * 备注
     */
    @Column(name = "remark")
    private String remark = "";

    /**
     * 是否可用
     */
    @Column(name = "is_active", nullable = false)
    private boolean enabled = true;

    /**
     * 是否删除
     */
    @Column(name = "is_deleted", nullable = false)
    private boolean deleted = false;

    /**
     * 创建用户
     */
    @Column(name = "created_by", nullable = false)
    private long creatorId = 0;

    /**
     * 创建时间
     */
    @Column(name = "created_time", nullable = false)
    private LocalDateTime creationTime;

    /**
     * 编辑用户
     */
    @Column(name = "modified_by")
    private long modifierId = 0;

    /**
     * 编辑时间
     */
    @Column(name = "modified_time")
    private LocalDateTime modificationTime;

    @Column(name = "question_mode_name")
    private String questionModeName = "";

    @Column(name = "solution_type_name")
    private String solutionTypeName = "";

    @Column(name = "creator_name")
    private String creatorName = "";

    @Column(name = "modifier_name")
    private String modifierName = "";
}